<template>
    <div class="drawerContainer">
        <el-form :model="propJson" label-width="auto" style="width: 100%">
            <el-form-item label="尺寸">
                <el-radio-group v-model="propJson.size">
                    <el-radio label="default">默认</el-radio>
                    <el-radio label="large">大号</el-radio>
                    <el-radio label="small">小号</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="显示提示内容">
                <el-input v-model="propJson.placeHolder" style="width: 100%" placeholder="显示提示内容" />
            </el-form-item>

            <el-form-item label="是否禁用">
                <el-radio-group v-model="propJson.isDisable">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="是否可清空">
                <el-radio-group v-model="propJson.isClearable">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="日期类型">
                <el-select v-model="propJson.type" placeholder="日期类型" style="width: 100%">
                    <el-option label="年" value="year" />
                    <el-option label="月" value="month" />
                    <el-option label="年月日" value="date" />
                    <el-option label="年月日时间" value="datetime" />
                    <el-option label="周" value="week" />
                    <el-option label="年月日 - 范围" value="daterange" />
                    <el-option label="年月日时间 - 范围" value="datetimerange" />
                </el-select>
            </el-form-item>

            <el-form-item label="是否进行字段拆分" v-if="propJson.type === 'daterange' || propJson.type === 'datetimerange'">
                <el-radio-group v-model="propJson.isFieldSplit">
                    <el-radio :label="true">是</el-radio>
                    <el-radio :label="false">否</el-radio>
                </el-radio-group>
            </el-form-item>

            <el-form-item label="绑定参数" v-if="propJson.type === 'year' || propJson.type === 'month' || propJson.type === 'date' || propJson.type === 'datetime' ||
                        propJson.type === 'week' || (propJson.type === 'daterange' && !propJson.isFieldSplit) || (propJson.type === 'datetimerange' && !propJson.isFieldSplit)">
                <el-select v-model="propJson.bindVariable" placeholder="参数名称" style="width: 100%">
                    <el-option v-for="info in commonParam" :label="info.variableName" :value="info.variableName" />
                </el-select>
            </el-form-item>

            <el-form-item label="绑定起始时间参数" v-if="(propJson.type === 'daterange' || propJson.type === 'datetimerange') && propJson.isFieldSplit">
                <el-select v-model="propJson.beginTimeBind" placeholder="参数名称" style="width: 100%">
                    <el-option v-for="info in commonParam" :label="info.variableName" :value="info.variableName" />
                </el-select>
            </el-form-item>

            <el-form-item label="绑定结束时间参数" v-if="(propJson.type === 'daterange' || propJson.type === 'datetimerange') && propJson.isFieldSplit">
                <el-select v-model="propJson.endTimeBind" placeholder="参数名称" style="width: 100%">
                    <el-option v-for="info in commonParam" :label="info.variableName" :value="info.variableName" />
                </el-select>
            </el-form-item>
        </el-form>
    </div>
</template>

<script name="DateDrawer" setup lang="ts">
import {computed, defineProps} from "vue";
import {useLowCodeStore} from "@/stores/lowcode/lowcode";

let props = defineProps(['commonParam']);

let commonParam = computed(() => {return props['commonParam']})

let propJson = computed(() => {return useLowCodeStore().lowCodeDrawerJsonInfo});

</script>

<style scoped lang="less">

</style>